package com.sikaryofficial.backend.utils;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;

/**
 * @author : wuweihong
 * @desc : TODO  请填写你的功能描述
 * @date : 2025-04-10
 */


public class CalendarUtils {

	public static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

	public static String getFirstDayOfMonth(int year, int month) {
		YearMonth yearMonth = YearMonth.of(year, month);
		LocalDateTime firstDay = yearMonth.atDay(1).atStartOfDay();
		return firstDay.format(formatter);
	}

	public static String getLastDayOfMonth(int year, int month) {
		YearMonth yearMonth = YearMonth.of(year, month);
		LocalDateTime firstDay = yearMonth.atEndOfMonth().atTime(23, 59, 59);
		return firstDay.format(formatter);
	}

	public static String getToday() {
		LocalDate localDate = LocalDate.now();
		LocalDateTime localDateTime = localDate.atStartOfDay();
		return localDateTime.format(formatter);
	}

}
